<?php

/*
	Class: CommerceMagentoCustomers

	About: Author
		Rich Joslin

	About: License
		<http://communit.as/docs/license>
*/
class CommerceMagentoCustomers extends Commerce_Db_Model_Magento {

	/* Group: Instance Methods */

	/*
		Function: getCustomers
	*/
	function getCustomers() {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer.list'
		);
	}

	/*
		Function: getCustomerInfo
	*/
	function getCustomerInfo($customer_id, $attributes = null) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer.info',
			array($customer_id, $attributes)
		);
	}

	/*
		Function: update
	*/
	function update($customer_id, $customer_data) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer.update',
			array($customer_id, $customer_data)
		);
	}

	/*
		Function: setPassword
	*/
	function setPassword($customer_id, $password) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer.setPassword',
			array($customer_id, $password)
		);
	}

	/*
		Function: getAddressBook
	*/
	function getAddressBook($customer_id) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer_address.list',
			array($customer_id)
		);
	}

	/*
		Function: getAddress
	*/
	function getAddressInfo($address_id) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer_address.info',
			array($address_id)
		);
	}

	/*
		Function: createAddress
	*/
	function createAddress($customer_id, $address_data) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer_address.create',
			array($customer_id, $address_data)
		);
	}

	/*
		Function: updateAddress
	*/
	function updateAddress($address_id, $address_data) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer_address.update',
			array($address_id, $address_data)
		);
	}

	/*
		Function: deleteAddress
	*/
	function deleteAddress($address_id) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'customer_address.delete',
			array($address_id)
		);
	}

}
